****
* REPLICATION MATERIAL ARTICLE EMANUELE (PERSPECTIVES ON POLITICS 2021) 'Lost in translation?  Class cleavage roots and left electoral mobilization in Western Europe'
****

use "dataset emanuele lost in translation 2021.dta"

//Figure 1
twoway (scatter class_bloc year, mcolor(black)) (qfit class_bloc year, lcolor(black) lpattern(dash)), xtitle("Year") xlabel(1945 (10) 2015) legend(off)

//Figure 2
twoway (line soc_hom100 year) (line class_org100 year), by(country) legend(label(1 "Social group strength") label(2 "Organizational density")) 

//Figure 3
scatter mean_soc_hom100 mean_class_org100, xline(29.47373, lcolor(black) lwidth(thin)) yline(43.87085, lcolor(black) lwidth(thin)) mlabel(country_short) ytitle("Social group strength") xtitle("Organizational density") graphregion(color(white)) plotregion(fcolor(white)) mcolor(black) mlabcolor(black) mlabsize(small) msize(small)

//Table 1
xtpcse class_bloc soc_hom100 class_org100 cult_frag economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
xtpcse class_bloc c.soc_hom100##c.class_org100  cult_frag  economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
xtpcse class_bloc c.soc_hom100##c.time class_org100 cult_frag economic_left_new polardalton ln_mdm org_frag i.south, corr(ar1) hetonly
xtpcse class_bloc soc_hom100 c.class_org100##c.time cult_frag economic_left_new polardalton ln_mdm org_frag i.south, corr(ar1) hetonly
xtpcse class_bloc c.soc_hom100##c.cult_frag class_org100  economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
xtpcse class_bloc soc_hom100 c.class_org100##c.cult_frag  economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
xtpcse class_bloc c.soc_hom100##c.economic_left_new class_org100 cult_frag  polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
xtpcse class_bloc soc_hom100 c.class_org100##c.economic_left_new cult_frag  polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly

//Figure 5
xtpcse class_bloc c.soc_hom100##c.class_org100 cult_frag economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
margins, dydx (soc_hom100) at (class_org100= (0 (10) 100)) vsquish
marginsplot, title("") xtitle("Organizational density") ytitle("Marginal effect of Social group strength")  legend(off) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) addplot(hist class_org100, percent yaxis(2) yscale(alt axis(2)) below color(none))
graph save soc_hom_class_org_hist.gph, replace

xtpcse class_bloc c.soc_hom100##c.class_org100 cult_frag economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
margins, dydx (class_org100) at (soc_hom100= (0 (10) 100)) vsquish
marginsplot, title("") xtitle("Social group strength") ytitle("Marginal effect of Organizational density") legend(off) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) addplot(hist soc_hom100, percent yaxis(2) yscale(alt axis(2)) below color(none))
graph save class_org_soc_hom_hist.gph, replace

graph combine soc_hom_class_org_hist.gph class_org_soc_hom_hist.gph

//Figure 6
xtpcse class_bloc c.soc_hom100##c.cult_frag class_org100 economic_left_new polardalton ln_mdm org_frag i.south time, corr(ar1) hetonly
margins, dydx (soc_hom100) at (cult_frag= (0 (0.1) 0.6)) vsquish
marginsplot, title("") xtitle("Fractionalization index") ytitle("Marginal effect of Social group strength") legend(off) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) addplot(hist cult_frag, percent yaxis(2) yscale(alt axis(2)) below color(none))


//Figure 7
xtpcse class_bloc soc_hom100 c.class_org100##c.year cult_frag economic_left_new polardalton ln_mdm org_frag i.south, corr(ar1) hetonly
margins, dydx (class_org100) at (year= (1946 (8) 2018)) vsquish
marginsplot, title("") xtitle("Time") ytitle("Marginal effect of Organizational density") legend(off) recast(line) plotopts(lcolor(black)) recastci(rline) ciopts(lpattern(dash) lcolor(black))

